package com.edushare.common.dao;

import java.util.HashMap;
import java.util.List;

import org.apache.cayenne.exp.Expression;
import org.apache.cayenne.query.SelectQuery;

import com.edushare.common.orm.ORMInterface;
import com.edushare.common.vo.FileDirTypes;

public class FileDirTypesDAO extends CayenneBasedDAO {

	
	public FileDirTypesDAO(ORMInterface ormInterface) {
		super(ormInterface);
	}
	
	@SuppressWarnings("unchecked")
	public FileDirTypes getFileDirTypes(String fileDirType){
		Expression exp = Expression.fromString("dirType = $dirType");
		HashMap hm = new HashMap();
		hm.put("dirType", fileDirType);
		SelectQuery query = new SelectQuery(FileDirTypes.class, exp.expWithParameters(hm));
		List<FileDirTypes> lst = getDataContext().performQuery(query);
		if(lst!=null && lst.size()>0)
			return lst.get(0);
		else
			return null;
	}

}
